<template>
	<view class="pb-100 pt-140">
		<view class="" v-if="data.banner.status">
			<image :src="data.banner.content" style="width: 100%; height: 218upx;" mode=""></image>
		</view>
		
		<view v-if="!data.show" class="px-2">
			<view class="font-weight" style="color: #bb6d17; font-size: 30upx;">php常见问题</view>
			<view class="py-2">Include 与 require的区别，require和require_once的效率哪个高？</view>
			<view class="py-2">Cookie和session的区别，禁止了cookie后session能正常使用吗？session的缺点是什么？session在服务器端是存在哪里的？是共有的还是私有的？</view>
			<view class="py-2">怎么防止sql注入？</view>
			<view class="py-2">数据库索引有几类，分别是什么？什么时候该用索引</view>
		</view>
		
		<view v-else>
			<view class="bg-white mx-3 p-3 mt-3 box-s bo-r2 " style="">
				<view class="" style="color: #bb6d17; font-weight: 700; font-size: 40upx;">| 七星</view>
				<view class="d-flex  j-sb py-3">
					<view class="d-flex j-center a-center">
						<view class="" style="font-size: 32upx;">
							<text style="color:#ffbc55; font-size: 32upx;">{{data.qxc.num}}</text>
							期
						</view>
						<view class="px-2" style="font-size: 30upx;">{{data.qxc.time}}</view>
						<view class="" style="font-size: 30upx;">{{data.qxc.week}}</view>
					</view>
					<!-- <view class="px-2" style="background-color: #ffbc55; color: #fff; border-radius: 20upx; font-size: 30upx;">
						开奖历史>
					</view> -->
				</view>			
				<view class="mt-2 d-flex j-sb">
					<block v-for="(item,index) in data.qxc.code" :key="index">
					<view v-if="index < 4" class="rounded-circle text-center j-center qixqiu font-big">{{item}}</view>
					<text v-else class="font-big" style="color: #bb6d17;line-height: 70upx; height: 70upx;">{{item}}</text>
					</block>
				</view>
			</view>
			<view class="bg-white m-3 p-3 box-s bo-r2" style="">
				<view class="" style="color: #bb6d17; font-weight: 700; font-size: 40upx;">| 排五</view>
				<view class="d-flex  j-sb py-3">
					<view class="d-flex j-center a-center">
						<view class="" style="font-size: 32upx;">
							<text style="color:#ffbc55; font-size: 32upx;">{{data.plw.num}}</text>
							期
						</view>
						<view class="px-2" style="font-size: 30upx;">{{data.plw.time}}</view>
						<view class="" style="font-size: 30upx;">{{data.plw.week}}</view>
					</view>
					<!-- <view class="px-2" style="background-color: #ffbc55; color: #fff; border-radius: 20upx; font-size: 30upx;">
						开奖历史>
					</view> -->
				</view>			
				<view class="d-flex">
					<block v-for="(item,index) in data.plw.code" :key="index">
					<view v-if="index < 4" class="rounded-circle text-center j-center qixqiu font-big">{{item}}</view>
					<text v-else class="font-big" style="color: #bb6d17; padding-left: 30upx;line-height: 70upx; height: 70upx; width: 70upx;">{{item}}</text>
					</block>
				</view>
			</view>
		</view>
		
		<view v-if="data.show" class="position-fixed text-center font py-1 font-weight" style="color: #000; left:0; bottom: 100upx; width: 100%;">
			数据来自于中国福彩官网 www.lottery.gov.cn
		</view>

		<ad unit-id="adunit-09d174bd84226612" ad-type="video" ad-theme="white"></ad>
		<tabBar :resdata="data.menu" v-if="data.show"></tabBar>
	</view>
</template>

<script>
	// import tabBar from "@/components/tab-bar/tab-bar.vue";
	export default {
		components: {
			// tabBar
		},
		data() {
			return {
				data: {
					plw: [],
					qxc: [],
					menu: [],
					show: 0,
					banner: {
						content: '',
						status: 0
					},
				}
			}
		},
		onShow() {
			this.getData()
		},
		onLoad() {
			
			
			
			// #ifdef APP-VUE
			let that = this;
			
			//获取版本号
			uni.plus.runtime.getProperty(uni.plus.runtime.appid, (widgetInfo) => {
				try {
					uni.showToast({
						title:'app'
					})
					// console.log('本地版本信息',widgetInfo)
					// let version = widgetInfo.version //版本号
					// //储存到缓存
					// uni.setStorageSync('version', version);
					// //储存到vuex
					// this.saveVersion(version)
			
				} catch (e) {
					console.error(e)
				}
			}, e => console.error(e))
			
			// if (!plus.runtime.isAgreePrivacy()) {
			// 	this.showPrivacy = true;
			// 	// this.showNoticeModal = false;
			// 	this.noticeModal(false)
			// }
			
			// // 监听设备网络状态变化事件，接口ios市场首次安装网络切换问题
			// plus.globalEvent.addEventListener("netchange", function() {
			// 	var nt = plus.networkinfo.getCurrentType(); //网络状态
			// 	if (
			// 		nt !== plus.networkinfo.CONNECTION_UNKNOW &&
			// 		nt !== plus.networkinfo.CONNECTION_NONE
			// 	) {
			// 		that.init();
			// 	}
			// });
			// #endif
		},
		methods: {
			// 加载数据
			getData() {
				this.$H.get('/index_data', {}, {
					
				}).then(res => {
					console.log(res)
					this.data = res
					// this.plw = res.plw
					// this.qxc = res.qxc
					// this.show = res.show
					// this.menu = res.menu
					// this.configs = res.configs
					// console.log((this.configs)['banner'])
					this.banner = (res.configs)['banner']

					// #ifdef MP
					this.data.menu = this.data.menu.slice(0,2)
					// #endif
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style>
	page{background: #fffcf5;}
	.qixqiu{
		line-height: 70upx; height: 70upx; width: 70upx; background-color: #ffbc55; color: #fff; 
	}
	.qixqiu + .qixqiu{margin-left: 20upx;}
</style>
